<template>
  <div class="dashboard-container">
    <h1>{{ $t('menu.dashboard') }}</h1>
    <el-row :gutter="20">
      <el-col :span="6" v-for="(card, index) in cards" :key="index">
        <el-card shadow="hover" class="dashboard-card">
          <div class="card-header">
            <el-icon :size="24" class="card-icon">
              <component :is="card.icon" />
            </el-icon>
            <div class="card-title">{{ card.title }}</div>
          </div>
          <div class="card-value">{{ card.value }}</div>
        </el-card>
      </el-col>
    </el-row>
  </div>
</template>

<script setup>
import { ref } from 'vue'
import { User, ShoppingCart, Goods, Money } from '@element-plus/icons-vue'

const cards = ref([
  {
    title: '用户总数',
    value: '1,234',
    icon: 'User'
  },
  {
    title: '订单总数',
    value: '3,456',
    icon: 'ShoppingCart'
  },
  {
    title: '商品总数',
    value: '2,345',
    icon: 'Goods'
  },
  {
    title: '收入总额',
    value: '¥23,456',
    icon: 'Money'
  }
])
</script>

<style scoped>
.dashboard-container {
  padding: 20px;
}

.dashboard-card {
  margin-bottom: 20px;
}

.card-header {
  display: flex;
  align-items: center;
  margin-bottom: 10px;
}

.card-icon {
  margin-right: 10px;
  color: #409EFF;
}

.card-title {
  font-size: 16px;
  color: #606266;
}

.card-value {
  font-size: 24px;
  font-weight: bold;
}
</style>